<template>
	<view>

		<u-sticky bgColor="#fff">
			<view class="mainpadding" :style="{paddingTop:menutop+'rpx'}">
				<view class="flexleft">
					<image src="@/static/image/system/hsz.png" class="hszclass" mode=""></image>
					<view class="xiaohei fonweight" style="font-size: 35rpx;">红十字基金会“孤寡老人大病救助基金”</view>
				</view>
				<view class="margin_top flexbetween">
					<view class="topliclass"></view>
					<view class="xiaohei fonweight sanshier" style="font-size: 32rpx;">首页</view>
					<image src="@/static/image/system/list.png" mode="" class="topliclass" @click="toplistfn"></image>
				</view>
			</view>
		</u-sticky>
		<view class="mainpadding bgl">
			<u-swiper :list="list1" keyName="image_text" height="160" indicator circular @click="lbtclick"
				radius="0"></u-swiper>
		</view>
		<view class="gonggao ffffff textcenter mainpadding xiaohong titletext yhxk margin_top"
			@click="jumpurl('/pages/index/gonggao')">
			<swiper class="" style="height: 50rpx;" circular autoplay vertical>
				<swiper-item v-for="item in text1" :key="item">
					<view class="">{{item}}</view>
				</swiper-item>
			</swiper>
		</view>
		<view class="mainpadding">
			<view class="flexbetween ffffff radius mainpadding">
				<image src="@/static/image/system/jzsq.png" style="width: 48%;" mode="widthFix"
					@click="navto(4)"></image>
				<image src="@/static/image/system/ylsq.png" style="width: 48%;" mode="widthFix"
					@click="navto(5)"></image>
			</view>
			<view class="ffffff radius margin_top" v-if="!isSH">
				<view class="flexbetween mainpadding" style="background-color: #f5f3f9;border-radius: 20rpx 20rpx 0 0;"
					@click="jumpurl('/pages/zhengce/zhengcejd')">
					<view class="flexleft">
						<view class="line margin_right2"></view>
						<view class=" fonweight xiaohei" style="font-size: 38rpx;">救助解读</view>
					</view>
					<view class="flexright">
						<view class="xiaohui titletext">更多</view>
						<u-icon name="arrow-right" size="16" color="#999"></u-icon>
					</view>
				</view>
				<view class="mainpadding2 ffffff" style="border-radius: 0 0 20rpx 20rpx;">
					<view class="flexbetween margin_top xiahuaxian" v-for="item in zcjdlist" :key="item.id"
						@click="jumpdetail('/pages/zhengce/zhengcexq?id=',item.id)">
						<view class="" style="width: 60%;">
							<view class="titletext xiaohei fonweight">{{item.name}}</view>
							<view class="xiaohui ershiba margin_top2 xiankuan3">{{item.des}}</view>
						</view>
						<image :src="item.image_text" mode="" class="radius" style="width: 200rpx;height: 150rpx;">
						</image>
					</view>
				</view>
			</view>
			<view class="ffffff radius margin_top">
				<!-- <view class="flexbetween mainpadding" style="background-color: #f8fcfa;border-radius: 20rpx 20rpx 0 0;"
					@click="jumpurl('/pages/index/teyaozj')">
					<view class="flexleft">
						<view class="line margin_right2"></view>
						<view class=" fonweight xiaohei" style="font-size: 38rpx;">特邀专家</view>
					</view>
					<view class="flexright">
						<view class="xiaohui titletext">更多</view>
						<u-icon name="arrow-right" size="16" color="#999"></u-icon>
					</view>
				</view> -->
				<!-- <view class="mainpadding2 ffffff" style="border-radius: 0 0 20rpx 20rpx;">
					<view class="flexbetween margin_top" v-for="item in tyzjlist" :key="item.id"
						@click="jumpdetail('/pages/index/zhuanjiaxq?id=',item.id)">
						<view class="ffffff margin_right3 radius"
							style="padding: 15rpx;box-shadow: 5rpx 5rpx 0 #d2d3d3;border: 1rpx solid #d2d3d3;">
							<image :src="item.image_text" style="width: 150rpx;height: 210rpx;" mode=""></image>
						</view>
						<view class="" style="width: 100%;">
							<view class="flexleft">
								<view class="titletext xiaohei fonweight margin_right2">{{item.name}}</view>
								<view class="smalltext xiaohui">{{item.zw}}</view>
							</view>
							<view class="margin_top radius"
								style="padding: 15rpx;box-shadow: 5rpx 5rpx 0 #d2d3d3;border: 1rpx solid #d2d3d3;width: 100%;height: 140rpx;">
								<view class="ershiba xiaohei xiankuan3">
									{{item.ysjs}}
								</view>
							</view>
						</view>
					</view>
				</view> -->
			</view>
			<view class="ffffff radius margin_top">
				<view class="flexbetween mainpadding" style="background-color: #fef4f8;border-radius: 20rpx 20rpx 0 0;"
					@click="jumpurl('/pages/index/dingdianyy')">
					<view class="flexleft">
						<view class="line margin_right2"></view>
						<view class=" fonweight xiaohei" style="font-size: 38rpx;">定点医院</view>
					</view>
					<view class="flexright">
						<view class="xiaohui titletext">更多</view>
						<u-icon name="arrow-right" size="16" color="#999"></u-icon>
					</view>
				</view>
				<view class="mainpadding2 ffffff" style="border-radius: 0 0 20rpx 20rpx;">
					<view class="flexbetween margin_top" v-for="item in ddyylist" :key="item.id"
						@click="jumpdetail('/pages/index/yiyuanxq?id=',item.id)">
						<view class="ffffff margin_right3 radius">
							<image :src="item.image_text" class="radius" style="width: 280rpx;height: 330rpx;" mode="">
							</image>
						</view>
						<view class="radius"
							style="padding: 15rpx;box-shadow: 5rpx 5rpx 0 #d2d3d3;border: 1rpx solid #d2d3d3;height: 300rpx;width: 100%;">
							<view class="titletext xiaohei fonweight yhxk" style="width: 250rpx;">{{item.name}}</view>
							<view class=" xiaohei ershiba margin_top2 xiankuan3" style="-webkit-line-clamp: 5;">{{item.des}}
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="flexcenter margin_top" @click="callphone(qzrxtel)">
				<view class="titletext xiaohei fonweight" style="font-size: 35rpx;">求助热线</view>
				<u-icon name="phone-fill" size="28" color="#66b730"></u-icon>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				// #ifdef H5
				menutop: 80,
				// #endif
				// #ifdef MP-WEIXIN
				menutop: 0,
				// #endif	
				list1: [],
				zcjdlist: [],
				tyzjlist: [],
				ddyylist: [],
				text1: [],
				qzrxtel: "",
				isSH:true
			}
		},
		onShareAppMessage: function(options) {
			return {
				title: '红十字基金会“孤寡老人大病救助基金”',
				imageUrl: '',
				path: '/pages/index/index'
			}
		},
		onShareTimeline: function() {
			return {
				title: '红十字基金会“孤寡老人大病救助基金”',
				imageUrl: '',
				path: '/pages/index/index'
			}
		},
		onLoad() {
			// #ifdef MP-WEIXIN
			this.menutop = uni.getMenuButtonBoundingClientRect().top * 2
			// #endif
			// #ifdef H5
			uni.setStorageSync("token","1626d321-a178-4c82-85c7-2086534bae0c")
			uni.setStorageSync("user_id","1")
			// #endif
			this.getshsystem()
			this.getbanner()
			this.getzcjd()
			this.gettyzj()
			this.getddyy()
			this.getgonggao()
			this.getsystem()
		},
		methods: {
			getshsystem() {
				let _this = this
				let system = uni.getSystemInfoSync()
				let version_code = system.appVersionCode
				httpRequest.request('/api/index/checkApply', 'GET', {
					platform:"wechat",
					version_code
				}).then(res => {
					console.log(version_code, res);
					this.isSH = res.data
				})
			},
			getsystem() {
				httpRequest.request('/api/index/getConfigInfoItem', 'GET', {
					pidtype: "otherset",
					type: "qzrxtel"
				}).then(res => {
					this.qzrxtel = res.data
				})
			},
			getgonggao() {
				httpRequest.request('/api/index/yljznoticeIndex', 'GET', {
					page: 1,
					limit: 12,
				}, false, false, true).then(res => {
					let arr = []
					res.data.data.forEach(item => {
						arr.push(item.des)
					})
					this.text1 = arr
				})
			},
			getzcjd() {
				httpRequest.request('/api/index/zcjdIndex', 'GET', {
					page: 1,
					limit: 3
				}).then(res => {
					this.zcjdlist = res.data.data
				}).catch(err => {})
			},
			gettyzj() {
				httpRequest.request('/api/index/tyzjIndex', 'GET', {
					page: 1,
					limit: 3
				}).then(res => {
					this.tyzjlist = res.data.data
				}).catch(err => {})
			},
			getddyy() {
				httpRequest.request('/api/index/ddyyIndex', 'GET', {
					page: 1,
					limit: 3
				}).then(res => {
					this.ddyylist = res.data.data
				}).catch(err => {})
			},
			getbanner() { //获取轮播图
				httpRequest.request('/api/index/getAdvertiseList', 'POST', {
					advertise_position_id: 1,
					is_more: 1,
				}).then(res => {
					this.list1 = res.data
				}).catch(err => {})
			},
			lbtclick(e) {
				let that = this
				uni.navigateTo({
					url: that.list1[e].url
				})
			},
			navto(val) {
				if (val == 0) { //首页
					console.log("首页");
					uni.switchTab({
						url: "/pages/index/index"
					})
				}
				if (val == 1) { //救助解读
					console.log("救助解读");
					uni.navigateTo({
						url: "/pages/zhengce/zhengcejd"
					})
				}
				if (val == 2) { //特邀专家
					console.log("特邀专家");
					uni.navigateTo({
						url: "/pages/index/teyaozj"
					})
				}
				if (val == 3) { //定点医院
					console.log("定点医院");
					uni.navigateTo({
						url: "/pages/index/dingdianyy"
					})
				}
				if (val == 4) { //救助申请
					console.log("救助申请");
					uni.switchTab({
						url: "/pages/jiuzhu/jiuzhu"
					})
				}
				if (val == 5) { //医疗申请
					console.log("医疗申请");
					uni.navigateTo({
						url: "/pages/index/yiliaosq"
					})
				}
				if (val == 6) { //公益报名
					console.log("公益报名");
					uni.navigateTo({
						url: "/pages/zhengce/gongyibm"
					})
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.gonggao {
		border: 1rpx solid rgba(0, 0, 0, .1);
		border-left: none;
		border-right: none;
	}

	.line {
		background: linear-gradient(180deg, #6c78b9 30%, #ffffff 100%);
		width: 10rpx;
		height: 40rpx;
	}
</style>